﻿using com.guojin.core.io;
using com.guojin.core.io.message;

namespace com.guojin.mj.net.message.login
{
    public class OptionEntry : Message
    {
        public static int TYPE = 7;
        public static int ID = 12;

        public string key { get; set; }
        public string value { get; set; }

        public void decode(Input _in)
        {
            key = _in.readString();
            value = _in.readString();
        }

        public void encode(Output _out)
        {
            _out.writeString(key);
            _out.writeString(value);
        }

        public int getMessageId()
        {
            return ID;
        }

        public int getMessageType()
        {
            return TYPE;
        }

        public string toString()
        {
            return "OptionEntry [key=" + key + ",value=" + value + ", ]";
        }

        public static OptionEntry create(string key, string value)
        {
            var optionEntry = new OptionEntry();
            optionEntry.key = key;
            optionEntry.value = value;
            return optionEntry;
        }
    }
}